package com.hq.door.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hq.door.dao.TInstituteDAO;
import com.hq.door.dao.TStudentDAO;
import com.hq.door.dto.InstituteInfo;
import com.hq.door.dto.StudentInfo;
import com.hq.door.pojo.TInstitute;
import com.hq.door.pojo.TStudent;
import com.hq.door.service.IOrgBackService;
import com.hq.door.service.StudentBackService;

/**
 * 获取学校结构信息服务实现类
 * @author Administrator
 *
 */
@Service("orgBackService")
public class OrgBackServiceImpl extends BaseServiceImpl<TInstitute> implements
		IOrgBackService {
	private TInstituteDAO tInstituteDAO;

	public TInstituteDAO gettInstituteDAO() {
		return tInstituteDAO;
	}

	@Autowired
	public void settInstituteDAO(TInstituteDAO tInstituteDAO) {
		this.tInstituteDAO = tInstituteDAO;
		this.setBaseDao(tInstituteDAO);
	}

	@Override
	public List<InstituteInfo> getOrg() {
		List<InstituteInfo> instituteInfos = new ArrayList<InstituteInfo>();
		List<TInstitute> tInstitutes = null;
		String hql = "from TInstitute";
		tInstitutes = tInstituteDAO.queryList(hql);
		for (TInstitute tInstitute : tInstitutes) {
			InstituteInfo instituteInfo = new InstituteInfo();
			instituteInfos.add(instituteInfo.getIns(tInstitute));
		}

		return instituteInfos;
	}

}
